<extend name="./Apps/Home/View/default/shops/layout.html" />
<block name="content">

<script src="__PUBLIC__/plugins/kindeditor/kindeditor.js"></script>
<script src="__PUBLIC__/plugins/kindeditor/lang/zh-CN.js"></script>
<script src="__PUBLIC__/jquery-ui/jquery-ui-1.10.4.custom.min.js"></script>
    <script src="__PUBLIC__/bootstrap/js/bootstrap.min.js"></script>

<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugins/webuploader/style.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/jquery-ui/css/base/jquery-ui-1.10.4.custom.min.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/bootstrap/css/bootstrap.min.css"/>
<style>
    button, input, select, textarea {
         line-height: normal;
    }

    .modal-dialog {
        width:900px;
    }

    .priceSpan{
        margin-left: 10px;
    }

    input[type=checkbox], input[type=radio] {
        margin: 0 0 0;
        margin-top: 0;
        line-height: normal;
    }


    .wst-page-content .btn{
       margin-top:0px;
        margin-left:0px;
    }




</style>
<script>
var ablumInit = false;
$(function () {
    goodsId = {$object.goodsId|default=0};
    initTime('useTimeStart','{$note.useTimeStart|default=7}');
    initTime('useTimeEnd','{$note.useTimeEnd|default=19}');

    initTime('priceStartTime','12');
    initTime('priceEndTime','18');

    $("#periodStart").datepicker({
        showButtonPanel:false,
        monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
        dayNamesMin: ['日','一','二','三','四','五','六'],
        prevText: '<上月',
        nextText: '下月>',
        currentText: '今天',
        dateFormat: 'yy-mm-dd'

    });
    $("#periodEnd").datepicker({
        showButtonPanel:false,
        monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
        dayNamesMin: ['日','一','二','三','四','五','六'],
        prevText: '<上月',
        nextText: '下月>',
        currentText: '今天',
        dateFormat: 'yy-mm-dd'
    });

    $("#startDate").datepicker({
        showButtonPanel:false,
        monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
        dayNamesMin: ['日','一','二','三','四','五','六'],
        prevText: '<上月',
        nextText: '下月>',
        currentText: '今天',
        dateFormat: 'yy-mm-dd'
    });
	   $('#tab').TabPanel1({tab:0,callback:function(no){
		    if(no==2 && !ablumInit)uploadAblumInit();
	   }});
       $("#priceTab").TabPanel({tab:0,callback:function(no){
           if(no == 2 && !ablumInit) uploadAblumInit();
       }});
	   $.formValidator.initConfig({
		   theme:'Default',mode:'AutoTip',formID:"myform",debug:true,submitOnce:true,onSuccess:function(){

               <if condition="session('WST_USER.goodsCatId1') eq 5 or session('WST_USER.goodsCatId1') eq 6">
                   $(".priceTabContent table").each(function(index){
                           $(this).find("tbody tr").each(function(){
                               var price = {};

                               price.priceId = $(this).children(".priceId").text();

                                   price.action=$(this).children(".action").text();//添加或修改

                                   price.isTom = $(this).children(".tomCheck").attr("value");
                                   price.priceStartTime = timeToFloat($(this).children(".priceStartTime").text());
                                   price.priceEndTime= timeToFloat($(this).children(".priceEndTime").text().substr(2));
                                   price.periodPrice = $(this).children(".periodPrice").text();
                                   price.weekDate = index + 1;

                               priceList.push(price);
                           }) ;
                       });
                       if(priceList.length == 0){
                           WST.msg("请设置价格", {icon: 5});
                           return false;
                       }
                   </if>
			       editGoods('{$umark}',priceList);
			       return false;
			},onError:function(msg){
		}});
	   $("#goodsSn").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,max:50,onError:"请输入商品编号"});
	   $("#goodsName").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,max:200,onError:"请输入商品名称"});
	 //  $("#marketPrice").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,max:50,onError:"请输入原价"});
	  <if condition="session('WST_USER.goodsCatId1') neq 5 and session('WST_USER.goodsCatId1') neq 6"> $("#shopPrice").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,max:50,onError:"请输入价格"});</if>
//	   $("#goodsStock").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,max:50,onError:"请输入库存"});

	   // $("#goodsUnit").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,max:50,onError:"请输入商品单位"});
	 // $("#goodsCatId1").formValidator({onFocus:"请选择商城分类"}).inputValidator({min:1,onError: "请选择完整商城分类"});
	  // $("#shopCatId2").formValidator({onFocus:"请选择本店分类"}).inputValidator({min:1,onError: "请选择完整本店分类"});

	   KindEditor.ready(function(K) {
			editor1 = K.create('textarea[name="goodsDesc"]', {
				height:'250px',
				width:"800px",
				allowFileManager : false,
				allowImageUpload : true,
				items:[
				        'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
				        'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
				        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
				        'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
				        'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
				        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|','image','multiimage','table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
				        'anchor', 'link', 'unlink', '|', 'about'
				],
				afterBlur: function(){ this.sync(); }
			});

           editor2 = K.create('textarea[name="useRule"]', {
               height:'250px',
               width:"800px",
               allowFileManager : false,
               allowImageUpload : true,
               items:[
                   'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
                   'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                   'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                   'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                   'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                   'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|','image','multiimage','table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                   'anchor', 'link', 'unlink', '|', 'about'
               ],
               afterBlur: function(){ this.sync(); }
           });

           editor3 = K.create('textarea[name="scheduleContent"]', {
               height:'250px',
               width:"400px",
               allowFileManager : false,
               allowImageUpload : true,
               items:[
                   'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
                   'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                   'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                   'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                   'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                   'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|','image','multiimage','table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                   'anchor', 'link', 'unlink', '|', 'about'
               ],
               afterBlur: function(){ this.sync(); }
           });
		});
	   <if condition="$object['goodsId'] !=0 ">
	   getCatListForEdit("goodsCatId2",{$object.goodsCatId1},0,{$object.goodsCatId2});
	   getCatListForEdit("goodsCatId3",{$object.goodsCatId2},1,{$object.goodsCatId3});
	   getShopCatListForEdit({$object.shopCatId1},{$object.shopCatId2},"shopCatId2");
	   </if>
	   var uploading = null;
	   uploadFile({
	    	  server:Think.U('Home/Goods/uploadPic'),pick:'#goodImgPicker',
	    	  formData: {dir:'goods'},
	    	  accept: {
	    	        title: 'Images',
	    	        extensions: 'gif,jpg,jpeg,png',
	    	        mimeTypes: 'image/*'
	    	  },
	    	  callback:function(f){
	    		  layer.close(uploading);
	    		  var json = WST.toJson(f);
	    		  $('#goodsImgPreview').attr('src',WST.DOMAIN+"/"+json.file.savepath+json.file.savethumbname);
	    		  $('#goodsImg').val(json.file.savepath+json.file.savename);
	    		  $('#goodsThums').val(json.file.savepath+json.file.savethumbname);
	    		  $('#goodsImgPreview').show();
		      },
		      progress:function(rate){
		    	  uploading = WST.msg('正在上传图片，请稍后...');
		      }
	   });


	   $('input[name="isDistribut"]').click(function(){
		   if($(this).val()==1){
			   $(".commission_tr").show();
		   }else{
			   $(".commission_tr").hide();
		   }
	   });
});

function imglimouseover(obj){
	if(!$(obj).find('.file-panel').html()){
		$(obj).find('.setdel').addClass('trconb');
		$(obj).find('.setdel').css({"display":""});
	}
}

function imglimouseout(obj){

	$(obj).find('.setdel').removeClass('trconb');
	$(obj).find('.setdel').css({"display":"none"});
}

function imglidel(obj){
	if (confirm('是否删除图片?')) {
		$(obj).parent().remove("li");
		return;
	}
}

function imgmouseover(obj){
	$(obj).find('.wst-gallery-goods-del').show();
}
function imgmouseout(obj){
	$(obj).find('.wst-gallery-goods-del').hide();
}
function delImg(obj){
    $(obj).parent().remove();
}
</script>
       <div class="wst-body">
       <div class='wst-page-header'>商家中心 > <if condition="$object['goodsId'] ==0 ">新增<else/>编辑</if>{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}资料</div>
       <div class='wst-page-content'>
       <div id='tab' class="wst-tab-box">
		<ul class="wst-tab-nav">
	    	<li>{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}信息</li>
            <if condition="session('WST_USER.goodsCatId1') eq 4 or session('WST_USER.goodsCatId1') eq 5 or session('WST_USER.goodsCatId1') eq 6">
                <li>购买须知</li>
            </if>
            <if condition="session('WST_USER.goodsCatId1') eq 7">
                <li>行程</li>
            </if>


	    </ul>



    	<div class="wst-tab-content" style='width:99%;margin-bottom: 10px;'>


       <form name="myform" method="post" id="myform" autocomplete="off">
    	<div class='wst-tab-item' style="position: relative;style='display:none'">

	        <input type='hidden' id='id' class='wstipt' value='{$object.goodsId}'/>

	        <input type='hidden' id='goodsThumbs' value='{$object.goodsThums}'/>
	        <table class="wst-form" >
	           <tr>
	             <th width='120'>{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}编号<font color='red'>*</font>：</th>
	             <td width='400'>
	             <input type='text' id='goodsSn' name='goodsSn' class="wst-ipt wstipt" value='{$object.goodsSn}' maxLength='25'/>
	             </td>

	           </tr>
                <tr>
                    <th width="120">商品图片：</th>
                    <td  valign='top'>
                        <div>
                            <img id='goodsImgPreview' class='lazyImg' data-original='<if condition="$object['goodsImg'] =='' ">__ROOT__/{$CONF['goodsImg']}<else/>__ROOT__/{$object['goodsImg']}</if>' height='152'/><br/>
                        </div>
                        <input type='hidden' id='goodsImg' class='wstipt' value='{$object.goodsImg}'/>
                        <input type='hidden' id='goodsThums' class='wstipt' value='{$object.goodsThums}'/>
                        <div id="goodImgPicker" style='margin-left:0px;margin-top:5px;height:30px;overflow:hidden;width:100px;'>上传{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}图片</div>
                        <div>图片大小:150 x 150 (px)，格式为 gif, jpg, jpeg, png</div>
                    </td>
                </tr>
	           <tr>
	             <th width='120'>{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}名称<font color='red'>*</font>：</th>
	             <td><input type='text' id='goodsName' name='goodsName' class="wst-ipt wstipt" value='{$object.goodsName}' maxLength='100'/></td>
	           </tr>
	            <!--<tr>-->
	             <!--<th width='120'>原价：</th>-->
	             <!--<td>-->
	             	<!--<input type='text' id='marketPrice' name='marketPrice' class="wstipt wst-ipt" value='{$object.marketPrice}' onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='10'/>-->
	             <!--</td>-->
	           <!--</tr>-->




                <if condition="session('WST_USER.goodsCatId1') eq 5 or session('WST_USER.goodsCatId1') eq 6">
                    <tr></tr>
                    <tr>
                        <th width="120">价格：</th>
                        <td>
                            <div class="wst-tab_box"  id="priceTab">
                                <ul class="wst-tab-nav">
                                    <li>周一</li>
                                    <li>周二</li>
                                    <li>周三</li>
                                    <li>周四</li>
                                    <li>周五</li>
                                    <li>周六</li>
                                    <li>周日</li>

                                </ul>
                                <div class="wst-tab-content priceTabContent" style="height:200px;overflow-y: scroll;">
                                    <div class="wst-tab-item" style="position: relative;style='display:none'">
                                        <!--<div class='wst-tbar-group' style='text-align:right'>-->
                                        <!--<span></span>-->
                                        <!--<button class="btn btn-default" type="button" style="padding: 6px 12px;height: 30px;line-height: 16px;margin-top: 0px;cursor: pointer;" id="toAddSchedule">新增</button>&nbsp;-->
                                        <!--</div>-->
                                        <a class="addPrice" style="position: absolute;height:40px;font-size: 20px;left:92%;padding-top:7px;"><span class="glyphicon glyphicon-plus-sign"></span></a>
                                        <table class='wst-list table1 '>
                                            <thead>
                                            <tr>

                                                <th>开始</th>
                                                <th>结束</th>
                                                <th>价格</th>

                                                <th width='150'>操作</th>

                                            </tr>
                                            </thead>
                                            <tbody>
                                            <volist name="monPrice" id="vo" key='i'>
                                                <tr class="priceTr">
                                                    <td style="display:none;" class="priceId">{$vo['priceId']}</td>
                                                    <td class="priceStartTime">{:WSTFloatToTime($vo['periodStart'])}</td>
                                                    <td class="tomCheck" style="display:none">{$vo['isTom']}</td>
                                                    <td class="priceEndTime"><if condition="$vo['isTom'] eq 1">次日<else/>今日</if>{:WSTFloatToTime($vo['periodEnd'])}</td>
                                                    <td class = "periodPrice" >{$vo['price']}</td>
                                                    <td style = "display:none" class="action">2</td>
                                                    <td>
                                                        <a class='btn edit priceEdit' title='编辑'></a>
                                                        <a  class='btn del priceDel' title='删除'></a>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </volist>
                                            <tfoot>
                                            </tfoot>
                                            </tbody>
                                        </table>
                                    </div>

                                    <div class='wst-tab-item' style="position: relative;style='display:none'">
                                        <a class="addPrice" style="position: absolute;height:40px;font-size: 20px;left:92%;padding-top:7px;"><span class="glyphicon glyphicon-plus-sign"></span></a>
                                        <table class='wst-list table2'>
                                            <thead>
                                            <tr>

                                                <th>开始</th>
                                                <th>结束</th>
                                                <th>价格</th>

                                                <th width='150'>操作</th>

                                            </tr>
                                            </thead>
                                            <tbody>
                                            <volist name="tuePrice" id="vo" key='i'>
                                                <tr class="priceTr">
                                                    <td style="display:none;" class="priceId">{$vo['priceId']}</td>
                                                    <td class="priceStartTime">{:WSTFloatToTime($vo['periodStart'])}</td>
                                                    <td class="tomCheck" style="display:none">{$vo['isTom']}</td>
                                                    <td class="priceEndTime"><if condition="$vo['isTom'] eq 1">次日<else/>今日</if>{:WSTFloatToTime($vo['periodEnd'])}</td>
                                                    <td class = "periodPrice" >{$vo['price']}</td>
                                                    <td style = "display:none" class="action">2</td>
                                                    <td>
                                                        <a class='btn edit priceEdit' title='编辑'></a>
                                                        <a  class='btn del priceDel' title='删除'></a>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </volist>
                                            <tfoot>
                                            </tfoot>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class='wst-tab-item' style="position: relative;style='display:none'">
                                        <a class="addPrice" style="position: absolute;height:40px;font-size: 20px;left:92%;padding-top:7px;"><span class="glyphicon glyphicon-plus-sign"></span></a>
                                        <table class='wst-list table3'id="scheduleList">
                                            <thead>
                                            <tr>

                                                <th>开始</th>
                                                <th>结束</th>
                                                <th>价格</th>

                                                <th width='150'>操作</th>

                                            </tr>
                                            </thead>
                                            <tbody>
                                            <volist name="wedPrice" id="vo" key='i'>
                                                <tr class="priceTr">
                                                    <td style="display:none;" class="priceId">{$vo['priceId']}</td>
                                                    <td class="priceStartTime">{:WSTFloatToTime($vo['periodStart'])}</td>
                                                    <td class="tomCheck" style="display:none">{$vo['isTom']}</td>
                                                    <td class="priceEndTime"><if condition="$vo['isTom'] eq 1">次日<else/>今日</if>{:WSTFloatToTime($vo['periodEnd'])}</td>
                                                    <td class = "periodPrice" >{$vo['price']}</td>
                                                    <td style = "display:none" class="action">2</td>
                                                    <td>
                                                        <a class='btn edit priceEdit' title='编辑'></a>
                                                        <a  class='btn del priceDel' title='删除'></a>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </volist>
                                            <tfoot>
                                            </tfoot>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class='wst-tab-item' style="position: relative;style='display:none'">
                                        <a class="addPrice" style="position: absolute;height:40px;font-size: 20px;left:92%;padding-top:7px;"><span class="glyphicon glyphicon-plus-sign"></span></a>
                                        <table class='wst-list table4'id="scheduleList">
                                            <thead>
                                            <tr>

                                                <th>开始</th>
                                                <th>结束</th>
                                                <th>价格</th>

                                                <th width='150'>操作</th>

                                            </tr>
                                            </thead>
                                            <tbody>
                                            <volist name="thuPrice" id="vo" key='i'>
                                                <tr class="priceTr">
                                                    <td style="display:none;" class="priceId">{$vo['priceId']}</td>
                                                    <td class="priceStartTime">{:WSTFloatToTime($vo['periodStart'])}</td>
                                                    <td class="tomCheck" style="display:none">{$vo['isTom']}</td>
                                                    <td class="priceEndTime"><if condition="$vo['isTom'] eq 1">次日<else/>今日</if>{:WSTFloatToTime($vo['periodEnd'])}</td>
                                                    <td class = "periodPrice" >{$vo['price']}</td>
                                                    <td style = "display:none" class="action">2</td>
                                                    <td>
                                                        <a class='btn edit priceEdit' title='编辑'></a>
                                                        <a  class='btn del priceDel' title='删除'></a>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </volist>
                                            <tfoot>
                                            </tfoot>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class='wst-tab-item' style="position: relative;style='display:none'">
                                        <a class="addPrice" style="position: absolute;height:40px;font-size: 20px;left:92%;padding-top:7px;"><span class="glyphicon glyphicon-plus-sign"></span></a>
                                        <table class='wst-list table5'id="scheduleList">
                                            <thead>
                                            <tr>

                                                <th>开始</th>
                                                <th>结束</th>
                                                <th>价格</th>

                                                <th width='150'>操作</th>

                                            </tr>
                                            </thead>
                                            <tbody>
                                            <volist name="friPrice" id="vo" key='i'>
                                                <tr class="priceTr">
                                                    <td style="display:none;" class="priceId">{$vo['priceId']}</td>
                                                    <td class="priceStartTime">{:WSTFloatToTime($vo['periodStart'])}</td>
                                                    <td class="tomCheck" style="display:none">{$vo['isTom']}</td>
                                                    <td class="priceEndTime"><if condition="$vo['isTom'] eq 1">次日<else/>今日</if>{:WSTFloatToTime($vo['periodEnd'])}</td>
                                                    <td class = "periodPrice" >{$vo['price']}</td>
                                                    <td style = "display:none" class="action">2</td>
                                                    <td>
                                                        <a class='btn edit priceEdit' title='编辑'></a>
                                                        <a  class='btn del priceDel' title='删除'></a>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </volist>
                                            <tfoot>
                                            </tfoot>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class='wst-tab-item' style="position: relative;style='display:none'">
                                        <a class="addPrice" style="position: absolute;height:40px;font-size: 20px;left:92%;padding-top:7px;"><span class="glyphicon glyphicon-plus-sign"></span></a>
                                        <table class='wst-list table6'id="scheduleList">
                                            <thead>
                                            <tr>

                                                <th>开始</th>
                                                <th>结束</th>
                                                <th>价格</th>

                                                <th width='150'>操作</th>

                                            </tr>
                                            </thead>
                                            <tbody>
                                            <volist name="satPrice" id="vo" key='i'>
                                                <tr class="priceTr">
                                                    <td style="display:none;" class="priceId">{$vo['priceId']}</td>
                                                    <td class="priceStartTime">{:WSTFloatToTime($vo['periodStart'])}</td>
                                                    <td class="tomCheck" style="display:none">{$vo['isTom']}</td>
                                                    <td class="priceEndTime"><if condition="$vo['isTom'] eq 1">次日<else/>今日</if>{:WSTFloatToTime($vo['periodEnd'])}</td>
                                                    <td class = "periodPrice" >{$vo['price']}</td>
                                                    <td style = "display:none" class="action">2</td>
                                                    <td>
                                                        <a class='btn edit priceEdit' title='编辑'></a>
                                                        <a  class='btn del priceDel' title='删除'></a>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </volist>
                                            <tfoot>
                                            </tfoot>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class='wst-tab-item' style="position: relative;style='display:none'">
                                        <a class="addPrice" style="position: absolute;height:40px;font-size: 20px;left:92%;padding-top:7px;"><span class="glyphicon glyphicon-plus-sign"></span></a>
                                        <table class='wst-list  table7'id="scheduleList">
                                            <thead>
                                            <tr>

                                                <th>开始</th>
                                                <th>结束</th>
                                                <th>价格</th>

                                                <th width='150'>操作</th>

                                            </tr>
                                            </thead>
                                            <tbody>
                                            <volist name="sunPrice" id="vo" key='i'>
                                                <tr class="priceTr">
                                                    <td style="display:none;" class="priceId">{$vo['priceId']}</td>
                                                    <td class="priceStartTime">{:WSTFloatToTime($vo['periodStart'])}</td>
                                                    <td class="tomCheck" style="display:none">{$vo['isTom']}</td>
                                                    <td class="priceEndTime"><if condition="$vo['isTom'] eq 1">次日<else/>今日</if>{:WSTFloatToTime($vo['periodEnd'])}</td>
                                                    <td class = "periodPrice" >{$vo['price']}</td>
                                                    <td style = "display:none" class="action">2</td>
                                                    <td>
                                                        <a class='btn edit priceEdit' title='编辑'></a>
                                                        <a  class='btn del priceDel' title='删除'></a>
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                            </volist>
                                            <tfoot>
                                            </tfoot>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>

                    <else/>
                    <tr>
                        <th width='120'>价格<font color='red'>*</font>：</th>
                        <td>
                            <if condition="$object.recommPrice gt 0">
                                <input type='text' id='shopPrice' name='shopPrice' disabled="disabled" class="wstipt wst-ipt" value='{$object.recommPrice}' onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='10'/>
                                <else/>
                                <input type='text' id='shopPrice' name='shopPrice' class="wstipt wst-ipt" value='{$object.shopPrice}' onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='10'/>
                            </if>

                        </td>
                    </tr>
                </if>


                <if condition="session('WST_USER.goodsCatId1') eq 3 or session('WST_USER.goodsCatId1') eq 6">
                    <tr>
                        <th width='120'>{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}大小<font color='red'>*</font>：</th>
                        <td><input type='text' id='roomSize' name='roomSize'  class="wstipt wst-ipt" value='{$object.roomSize}' />
                            <if condition="session('WST_USER.goodsCatId1') eq 3">
                                平米
                                <else/>
                                人
                            </if>


                        </td>
                    </tr>


                </if>

	           <!--<?php if($GLOBALS['CONFIG']['isDistribut'] == 1 && $shopCfg["isDistribut"]==1 && $shopCfg["distributType"]==1){ ?>-->
	           <!--<tr>-->
	             <!--<th width='120'>是否分销商品<font color='red'>*</font>：</th>-->
	             <!--<td colspan='3'>-->
	             <!--<label>-->
	             <!--<input type='radio' name='isDistribut' class='wstipt' <if condition="$object['isDistribut'] ==1 ">checked</if> value='1'/>是-->
	             <!--</label>-->
	             <!--<label>-->
	             <!--<input type='radio' name='isDistribut' class='wstipt' <if condition="$object['isDistribut'] ==0 ">checked</if> value='0'/>否-->
	             <!--</label>-->
	             <!--</td>-->
	           <!--</tr>-->
	           <!---->
	           <!--<tr class='commission_tr' <if condition="$object['isDistribut'] ==0 ">style="display:none;"</if>>-->
	             <!--<th width='120'>佣金：</th>-->
	             <!--<td>-->
	             	<!--<input type='text' id='commission' name='commission' class="wstipt wst-ipt" value='{$object.commission}' onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='10'/>用于分销的分成金额-->
	             <!--</td>-->
	           <!--</tr>-->
	           <!--<?php } ?>-->
	            <!--<tr>-->
	             <!--<th width='120'>商品库存<font color='red'>*</font>：</th>-->
	             <!--<td><input type='text' id='goodsStock' name='goodsStock' class="wstipt wst-ipt" value='{$object.goodsStock}' onkeypress="return WST.isNumberKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='25' <if condition="count($object['priceAttrs']) gt 0 ">disabled</if> /></td>-->
	           <!--</tr>-->
	           <!--<tr>-->
	             <!--<th width='120'>单位<font color='red'>*</font>：</th>-->
	             <!--<td><input type='text' id='goodsUnit' name='goodsUnit' class="wstipt wst-ipt" value='{$object.goodsUnit}'  maxLength='25'/></td>-->
	           <!--</tr>-->
	           <!--<tr>-->
	             <!--<th width='120'>商品SEO关键字：</th>-->
	             <!--<td colspan='3'>-->
	             <!--<input type='text' style="width:788px" id='goodsKeywords' class='wstipt' name='goodsKeywords' value='{$object.goodsKeywords}' maxlength="100">-->
	             <!--</td>-->
	           <!--</tr>-->

	           <!--<tr>-->
	             <!--<th width='120'>商品状态<font color='red'>*</font>：</th>-->
	             <!--<td colspan='3'>-->
	             <!--<label>-->
	             <!--<input type='radio' id='isSale1' name='isSale' class='wstipt' <if condition="$object['isSale'] ==1 ">checked</if> value='1'/>上架-->
	             <!--</label>-->
	             <!--<label>-->
	             <!--<input type='radio' id='isSale0' name='isSale' class='wstipt' <if condition="$object['isSale'] ==0 ">checked</if> value='0'/>下架-->
	             <!--</label>-->
	             <!--</td>-->
	           <!--</tr>-->
                <if condition="session('WST_USER.goodsCatId1') neq 7">
                    <tr>
                        <th width='120'>{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}信息：</th>
                        <td colspan='3'>
                            <textarea rows="2" style="width:788px" id='goodsSpec' class='wstipt' name='goodsSpec'>{$object.goodsSpec}</textarea>
                        </td>
                    </tr>
                    <!--<tr>-->
                        <!--<th width='120'>{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}属性：</th>-->
                        <!--<td colspan='3'>-->
                            <!--<label>-->
                                <!--<input type='checkbox' id='isRecomm' name='isRecomm' class='wstipt'-->
                                <!--<if condition="$object['isRecomm'] ==1 ">checked</if>-->
                                <!--value='1'/>推荐-->
                            <!--</label>-->
                            <!--<label>-->
                                <!--<input type='checkbox' id='isBest' name='isBest' class='wstipt'-->
                                <!--<if condition="$object['isBest'] ==1 ">checked</if>-->
                                <!--value='1'/>精品-->
                            <!--</label>-->
                            <!--<label>-->
                                <!--<input type='checkbox' id='isNew' name='isNew' class='wstipt'-->
                                <!--<if condition="$object['isNew'] ==1 ">checked</if>-->
                                <!--value='1'/>新品-->
                            <!--</label>-->
                            <!--<label>-->
                                <!--<input type='checkbox' id='isHot' name='isHot' class='wstipt'-->
                                <!--<if condition="$object['isHot'] ==1 ">checked</if>-->
                                <!--value='1'/>热销-->
                            <!--</label>-->
                        <!--</td>-->
                    <!--</tr>-->
                    <tr>
                        <th width='120'>{:WSTGetGoodsTitle(session("WST_USER.goodsCatId1"))}描述<font color='red'>*</font>：
                        </th>
                        <td colspan='3'>
                            <textarea rows="2" cols="60" id='goodsDesc' class='wstipt' name='goodsDesc'>{$object.goodsDesc}</textarea>
                        </td>
                    </tr>

                    <else/>
                    <tr>
                        <th>出团日期<font color='red'>*</font>：</th>

                        <td><input type='text' id='startDate' name='startDate' class="wst-ipt wstipt"   readonly="readonly" value="{$object.startDate}"/>
                           </td>
                    </tr>
                    <tr>
                        <th>出发城市<font color='red'>*</font>：</th>

                        <td><input type='text' id='startCity' name='startCity' class="wst-ipt wstipt" value='{$object.startCity}' maxLength='20'/></td>

                    </tr>

                </if>


	           <!--<tr>-->
	             <!--<th width='120'>商城分类<font color='red'>*</font>：</th>-->
	             <!--<td colspan='3'>-->
	             <!--<select id='goodsCatId1' class='wstipt' onchange='javascript:getCatListForEdit("goodsCatId2",this.value,0)'>-->
	                <!--<option value=''>请选择</option>-->
	                <!--<volist name="goodsCatsList" id="vo">-->
	                <!--<option value='{$vo['catId']}' <if condition="$object['goodsCatId1'] == $vo['catId'] ">selected</if>>{$vo['catName']}</option>-->
	                <!--</volist>-->
	             <!--</select>-->
	             <!--<select id='goodsCatId2' class='wstipt' onchange='javascript:getCatListForEdit("goodsCatId3",this.value,1);'>-->
	                <!--<option value=''>请选择</option>-->
	             <!--</select>-->
	             <!--<select id='goodsCatId3' class='wstipt'>-->
	                <!--<option value=''>请选择</option>-->
	             <!--</select>-->
	             <!--</td>-->
	           <!--</tr>-->
	           <!--<tr>-->
	             <!--<th width='120'>本店分类<font color='red'></font>：</th>-->
	             <!--<td colspan='3'>-->
	             <!--<select id='shopCatId1' class='wstipt' onchange='javascript:getShopCatListForEdit(this.value,"{$object[shopCatId2]}","shopCatId2")'>-->
	                <!--<option value='0'>请选择</option>-->
	                <!--<volist name="shopCatsList" id="vo">-->
	                <!--<option value='{$vo['catId']}' <if condition="$object['shopCatId1'] == $vo['catId'] ">selected</if>>{$vo['catName']}</option>-->
	                <!--</volist>-->
	             <!--</select>-->
	             <!--<select id='shopCatId2' class='wstipt'>-->
	                <!--<option value='0'>请选择</option>-->
	             <!--</select>-->
	             <!--</td>-->
	           <!--</tr>-->
	           <!--<tr>-->
	             <!--<th width='120' align='right'>品牌：</th>-->
	             <!--<td>-->
	             <!--<select id='brandId' class='wstipt' dataVal='{$object["brandId"]}'>-->
	                <!--<option value='0'>请选择</option>-->
	             <!--</select>-->
	             <!--</td>-->
	           <!--</tr>-->

	           <tr>
	             <td colspan='3' style='text-align:center'>
	                 <button class='wst-btn-query ' type="submit">保&nbsp;存</button>


	             </td>
	           </tr>
	        </table>

	      </div>

           <if condition="session('WST_USER.goodsCatId1') eq 4 or session('WST_USER.goodsCatId1') eq 5 or session('WST_USER.goodsCatId1') eq 6">

            <div class='wst-tab-item' style="position: relative;style='display:none'">
                <table class="wst-form">
                    <tr>
                        <th width='120'>有效期：</th>
                        <td><input type='text' id='periodStart' name='periodStart' class="wst-ipt wstipt"   readonly="readonly" value="{$note.periodStart}"/>-
                            <input type='text' id='periodEnd' name='periodEnd' class="wst-ipt wstipt"   readonly="readonly" value="{$note.periodEnd}"/></td>
                    </tr>

                    <tr>
                        <th width='120'>使用时间：</th>
                        <td><select  id='useTimeStart' name='useTimeStart' class="wst-ipt wstipt" ></select> -
                            <select id='useTimeEnd' name='useTimeEnd' class="wst-ipt wstipt"   ></select></td>
                    </tr>

                    <tr>
                        <th width='120'>使用规则*</font>：</th>
                        <td colspan='3'>
                            <textarea rows="2" cols="60" id='useRule' class='wstipt' name='useRule'>{$note.useRule}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td colspan='3' style='padding-left:320px;'>
                            <button class='wst-btn-query' type="submit">保&nbsp;存</button>
                            <if condition="$umark !='toEdit' ">
                                <button class='wst-btn-query' type="button" onclick='javascript:location.href="{:U('Home/Goods/'.$umark)}"'>返&nbsp;回</button>
                            </if>
                        </td>
                    </tr>
                </table>
            </div>
               </if>

            <if condition = "session('WST_USER.goodsCatId1') eq 7">
                <div class='wst-tab-item' style="position: relative;style='display:none'">

                        <div class='wst-tbar-group' style='text-align:right'>
                            <span></span>
                            <button class="btn btn-default" type="button" style="padding: 6px 12px;height: 30px;line-height: 16px;margin-top: 0px;cursor: pointer;" id="toAddSchedule">新增</button>&nbsp;
                        </div>
                        <table class='wst-list'id="scheduleList">
                            <thead>
                            <tr>

                                <th>顺序</th>
                                <th>起点</th>
                                <th>终点</th>
                                <th>交通</th>
                                <th>图片</th>
                                <th width='150'>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="schedule" id="vo" key='i'>
                                <tr scheduleId="{$vo['scheduleId']}">
                                    <td style="display:none;" class="scheduleId">{$vo['scheduleId']}</td>
                                    <td class="scheduleSort">{$vo['scheduleSort']}</td>
                                    <td class="startPoint">{$vo['startPoint']}</td>
                                    <td class="endPoint">{$vo['endPoint']}</td>
                                    <td class="transport">{$vo['transport']}</td>
                                    <td class="scheduleThums"><img src="{$vo['scheduleThums']}" style="width:100px;height: 100px;padding:2px;"></td>
                                    <td class = "scheduleContent" style="display:none;">{$vo['scheduleContent']}</td>
                                    <td>
                                        <a class='btn edit' title='编辑'></a>
                                        <a  class='btn del' title='删除'></a>
                                        &nbsp;
                                    </td>
                                </tr>
                            </volist>
                            <tfoot>
                            </tfoot>
                            </tbody>
                        </table>
                </div>

            </if>


       </form>


       </div>
       </div>

       </div>
       <div style='clear:both;'></div>
       </div>


    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="myModalLabel">行程信息</h4>
                </div>
                <div class="modal-body">


                    <form name="scheduleform" method="post" id="scheduleform" autocomplete="off">
                        <input type='hidden' id='scheduleId' class='wstipt' name="scheduleId"/>
                        <input type='hidden' id='scheduleThumbs'/>

                        <table class="wst-form">

                            <tr>
                                <th width='120'>图片<font color='red'>*</font>：</th>
                                <td  valign='top'>
                                    <div>
                                        <img id='scheduleImgPreview' class='lazyImg' data-original='__ROOT__/{$CONF['goodsImg']}' height='152'/><br/>
                                    </div>
                                    <input type="file" id="selectFile" name="scheduleImg">

                                    <div>图片大小:150 x 150 (px)，格式为 gif, jpg, jpeg, png</div>
                                </td>
                            </tr>
                            <tr>
                                <th width='120'>顺序<font color='red'>*</font>：</th>
                                <td>
                                    <input type='text' id='scheduleSort' name='scheduleSort' class="wstipt wst-ipt" value='{$schedule.scheduleSort}' onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='3'/>
                                </td>
                            </tr>
                            <tr>
                                <th width='120'>起点<font color='red'>*</font>：</th>
                                <td><input type='text' id='startPoint' name='startPoint' class="wst-ipt wstipt"
                                           maxLength='100'/></td>
                            </tr>
                            <tr>
                                <th width='120'>终点<font color='red'>*</font>：</th>
                                <td>
                                    <input type='text' id='endPoint' name='endPoint' class="wstipt wst-ipt"
                                            />
                                </td>
                            </tr>

                            <tr>
                                <th width='120'>交通方式<font color='red'>*</font>：</th>
                                <td>
                                    <select name="transport" id="transport" class="wstipt wst-ipt">
                                        <option value="飞机">飞机</option>
                                        <option value="火车">火车</option>
                                        <option value="汽车">汽车</option>
                                    </select>

                                </td>
                            </tr>


                            <tr>
                                <th width='120'>内容<font color='red'>*</font>：</th>
                                <td colspan='3'>
                                    <textarea rows="2" cols="60" id='scheduleContent' class='wstipt'
                                              name='scheduleContent'></textarea>
                                </td>
                            </tr>
                        </table>
                        <input type="reset" name="reset" style="display: none;" />
                    </form>



                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="saveSchedule">保存</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>


    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="myModalLabel1">添加时段价格</h4>
                </div>
                <div class="modal-body">

                                    <div class="xingqiCheck">
                                    <label class="checkbox-inline">
                                        <input type="checkbox" id="monCheck" value="1" > 星期一
                                    </label>
                                    <label class="checkbox-inline">
                                        <input type="checkbox" id="tueCheck" value="2"> 星期二
                                    </label>
                                    <label class="checkbox-inline">
                                        <input type="checkbox" id="wedCheck" value="3"> 星期三
                                    </label>
                                    <label class="checkbox-inline">
                                        <input type="checkbox" id="thuCheck" value="4"> 星期四
                                    </label>
                                    <label class="checkbox-inline">
                                        <input type="checkbox" id="friCheck" value="5"> 星期五
                                    </label>
                                    <label class="checkbox-inline">
                                        <input type="checkbox" id="satCheck" value="6"> 星期六
                                    </label>
                                    <label class="checkbox-inline">
                                        <input type="checkbox" id="sunCheck" value="7"> 星期日
                                    </label>

                                </div>
                                <div style="margin-top: 20px;">
                                    <span class="priceSpan">开始时间：<select  id='priceStartTime' class="wstipt wst-ipt" > </select></span>





                                    <span class="priceSpan">结束时间：<select  type='text' id='priceEndTime'  class="wstipt wst-ipt"  ></select></span>
                                    <span class="priceSpan"><label class="checkbox-inline">
                                        <span style="margin-right: 20px;">次日：</span><input type="checkbox" id="tomCheck" value="1">
                                    </label></span>




                                   <span class="priceSpan"> 价格：<input type='text' id='periodPrice' class="wst-ipt wstipt"
                                              onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='10'/></span>
                                </div>




                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="savePrice">保存</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>

    <script>


        function floatToTime(f){
            var rs = "";
            if(parseInt(f) == f){
                rs = parseInt(f)+":00";
            }else{
                rs = parseInt(f)+":30";
            }
            return rs;
        }

        function timeToFloat(time){
            var f = time.split(":");
            return parseInt(f[0]) + f[1]/60;
        }

        var xingqiArray = new Array();
        var isEdit = false;
        var currentEditPrice = null;
        var priceList = new Array();




        $(".addPrice").click(function(){

            $(".xingqiCheck").show();
            $("#myModal1").modal("show");
            isEdit = false;
        });

        $(".xingqiCheck [type = checkbox]").change(function(){
           if($(this).attr("checked")){
               $(this).attr("checked",false);
           }else{
               $(this).attr("checked",true);
           }
        });


        $("#tomCheck").change(function(){
            if($(this).attr("checked")){
                $(this).attr("checked",false);
                $(this).val(0);
            }else{
                $(this).attr("checked",true);
                $(this).val(1);
            }
        });



        $("#savePrice").click(function(){

            if(!isEdit && !$("#monCheck").attr("checked") && !$("#tueCheck").attr("checked") && !$("#wedCheck").attr("checked")
                    && !$("#thuCheck").attr("checked") && !$("#monCheck").attr("checked")&& !$("#friCheck").attr("checked")
                    && !$("#satCheck").attr("checked")&& !$("#sunCheck").attr("checked")){
                WST.msg("请选择星期几", {icon: 5});
                return false;


            }
            xingqiArray.splice(0,xingqiArray.length);
            $(".xingqiCheck [type=checkbox]").each(function(){
                if($(this).attr("checked")){
                    xingqiArray.push($(this).val());
                }
            });



            if(!$("#periodPrice").val()){
                WST.msg("请输入价格", {icon: 5});
                return false;
            }



            var tom = "今日";
            if($("#tomCheck").attr("checked")){
                tom = "次日";
            }

            if(!isEdit){
                var trStr = "<tr class='priceTr'><td class='priceId' style='display:none;'>0</td><td class='priceStartTime'>" + floatToTime($("#priceStartTime").val()) +
                        "</td><td class='tomCheck' style='display:none' value='" + $("#tomCheck").val() + "'></td><td class='priceEndTime'>" +
                        tom + floatToTime($("#priceEndTime").val())
                        + "</td><td class='periodPrice'>" + $("#periodPrice").val() +
                        "</td><td class='action' style='display:none;'>1</td><td class='priceControl'> <a class='btn edit priceEdit' title='编辑'></a> <a  class='btn del priceDel' title='删除'></a> &nbsp;</td></tr>"

                for(var i = 0;i<xingqiArray.length;i++){
                    $(".table"+xingqiArray[i]+" tbody").append(trStr);
                }


            }else{
                currentEditPrice.children(".priceEndTime").text(tom+floatToTime($("#priceEndTime").val()));
                currentEditPrice.children(".priceStartTime").text(floatToTime($("#priceStartTime").val()));
                currentEditPrice.children(".periodPrice").text($("#periodPrice").val());
                currentEditPrice.children(".action").text(2);
            }


            $("#myModal1").modal("hide");
        });


        /**
         * 打开编辑框
         */

        $(document).on("click"," .priceEdit ",function(){
            isEdit = true;
            $(".xingqiCheck").hide();

            currentEditPrice = $(this).parent().parent();

            //设置起始时间
            initTime('priceStartTime',timeToFloat(currentEditPrice.children(".priceStartTime").text()));
            initTime('priceEndTime',timeToFloat(currentEditPrice.children(".priceEndTime").text()));


            //设置是否为次日
            var tomCheck = currentEditPrice.children(".tomCheck").attr("value");
            if(tomCheck == 1){
                $("#tomCheck").attr("checked",true).val(1);
            }else{
                $("#tomCheck").attr("checked",false).val(0);
            }

            //设置价格
            $("#periodPrice").val(currentEditPrice.children(".periodPrice").text());

           $("#myModal1").modal("show");
        });

        /**
         * 删除时段价格
         */

        $(document).on("click",".priceDel",function(){

            currentEditPrice = $(this).parent().parent();
            console.log(currentEditPrice.children(".priceId").text());
            if(currentEditPrice.children(".priceId").text() == 0){
                currentEditPrice.remove();
            }else{
                currentEditPrice.children(".action").text(0);
                currentEditPrice.hide();
            }
        });


        $("#toAddSchedule").click(function(){
            $("input[type=reset]").trigger("click");
            $("#myModal").modal('show');
        });


        $("#selectFile").change(function(){
            var fileList = this.files;

            $("#scheduleImgPreview").attr("src",window.URL.createObjectURL(fileList[0]));


        });



        $("#scheduleList .edit").click(function(){

            $("#scheduleImgPreview").attr("src",$(this).parent().siblings(".scheduleThums").children().attr("src"));
            $("#scheduleSort").val($(this).parent().siblings(".scheduleSort").text());
            $("#startPoint").val($(this).parent().siblings(".startPoint").text());
            $("#endPoint").val($(this).parent().siblings(".endPoint").text());
            $("#transport").val($(this).parent().siblings(".transport").text());
            $("#scheduleThumbs").val($(this).parent().siblings(".scheduleThums").children().attr("src"));
            console.log($("#scheduleThumbs").val() == '');
            $("#scheduleId").val($(this).parent().siblings(".scheduleId").text());
            editor3.html($(this).parent().siblings(".scheduleContent").text());
            $("#scheduleContent").val($(this).parent().siblings(".scheduleContent").text());
            $("#myModal").modal('show');

        });

        $("#scheduleList .del").click(function(){
            var scheduleId = $(this).parent().parent().attr("scheduleId");
            layer.confirm("您确定要删除该行程吗？",{icon: 3, title:'系统提示'},function(tips){
                $.post("{:U('Home/Goods/delSchedule')}",{scheduleId:scheduleId},function(data,textStatus){
                    layer.close(tips);
                    var json = WST.toJson(data);
                    if(json.status=='1'){
                        WST.msg('操作成功！', {icon: 1},function(){
                            location.reload();
                        });
                    }else{
                        WST.msg('操作失败', {icon: 5});
                    }
                });
            });
        });
        $("#saveSchedule").click(function(){
            console.log(goodsId);
            if(!goodsId){
                WST.msg("未添加任何跟团游", {icon: 5});
                return false;
            }

            if((($("#selectFile")[0].files.length == 0 ) && ($("#scheduleThumbs").val() == ''))|| ($("#startPoint").val() == '')||( $("#endPoint").val()=='' )|| ($("#transport").val() == '') ){
                WST.msg("有数据没填写完整", {icon: 5});
                return false;
            }
            var formData = new FormData($("#scheduleform")[0]);
            formData.append("travelId",goodsId);
//            formData.append("scheduleImg",$("#selectFile")[0].files[0]);
//            formData.append('startPoint',$('#startPoint').val());
//            formData.append('endPoint',$("#endPoint").val());
//            formData.append('transport',$("#transport").val());
           // formData.append('scheduleContent',$("#scheduleContent").val());
            $.ajax({
                    url:"{:U('Home/Goods/editSchedule')}",
                    data:formData,
                    type:"post",
                    processData: false,  // 告诉jQuery不要去处理发送的数据
                    contentType: false,   // 告诉jQuery不要去设置Content-Type请求头
                    success:function(data){
                        console.log(data);
                        $("#myModal").modal('hide');
                        if(data.a == 1){
                            $("[scheduleId='"+data.scheduleId+"']").children(".scheduleSort").text(data.scheduleSort);
                           $("[scheduleId='"+data.scheduleId+"']").children(".startPoint").text(data.startPoint);
                            $("[scheduleId='"+data.scheduleId+"']").children(".endPoint").text(data.endPoint);
                            $("[scheduleId='"+data.scheduleId+"']").children(".transport").text(data.transport);
                            $("[scheduleId='"+data.scheduleId+"']").children(".scheduleContent").text(data.scheduleContent);
                            if(data.scheduleThums){
                                $("[scheduleId='"+data.scheduleId+"']").children(".scheduleThums").children().attr("src",data.scheduleThums);
                            }

                        }else{
                            var tr = "<tr> <td style='display:none;' class='scheduleId'>" + data.scheduleId + "</td><td class='scheduleSort'>"+data.scheduleSort+"</td><td class='startPoint'>" +
                                    data.startPoint + "</td><td class='endPoint'>" + data.endPoint + "</td> <td class='transport'>" +
                                    data.transport + "</td> <td class='scheduleThums'><img style='width:100px;height: 100px;padding:2px;'src='" + data.scheduleThums + "'></td><td class='scheduleContent' style='display:none;'>" +
                                    data.scheduleContent + "</td><td> <a class='btn edit' title='编辑'></a> <a class='btn del' title='删除'></a> &nbsp; </td> </tr>";
                            $("#scheduleList").children("tbody").append(tr);
                        }



                    }
            });




        });
    </script>

</block>  